package problems;

import lib.MathLib;

public class Euler047 extends AbstractEuler {

	private static final int NUMBER_WE_ARE_LOOKING_FOR = 4; //i.e. this many consecutive numbers with this many distinct prime factors
	
	@Override
	public Number calculate() {
		int first = 1;
		for (int i = first, consecutiveFound = 0; consecutiveFound < NUMBER_WE_ARE_LOOKING_FOR; i++) {
			if (MathLib.numberOfDistinctFactors(i) == NUMBER_WE_ARE_LOOKING_FOR) {
				consecutiveFound++;
			} else {
				first = i + 1; //better luck next time
				consecutiveFound = 0;
			}
		}
		return first;
	}

	@Override
	protected Number getCorrectAnswer() {
		return 134043;
	}

}
